package com.cmower.baeldung.synchronized1;

public class SynchronizedMethod {
    private int sum;

    public int getSum() {
        return sum;
    }

    public void setSum(int sum) {
        this.sum = sum;
    }

    public void calculate() {
        setSum(getSum() + 1);
    }

public synchronized void synchronizedCalculate() {
    setSum(getSum() + 1);
}

public void synchronisedThis() {
    synchronized (this) {
        setSum(getSum() + 1);
    }
}
}
